package com.serv.admin;

import com.jfinal.aop.Inject;
import com.jfinal.kit.StrKit;
import com.serv.common.base.BaseController;
import com.serv.common.model.sys.Organization;
import com.serv.common.model.sys.User;
import com.serv.common.service.sys.OrganizationService;

public class SidebarController extends BaseController {
	@Inject
	OrganizationService orgService;
	
	public void organizations(String id) {
		if(StrKit.isBlank(id)) {
			User user = getSubject();
			setAttr("orgTree",user.organization().treeDescendant());
		}else{
			Organization org = orgService.findById(id);
			setAttr("orgTree",org.treeDescendant());
		}
		render("organizations.html");
	}
	
	public void setting() {
		render("setting.html");
	}
	
	public void menu(Integer id) {
		keepPara();
		render("menu.html");
	}
}
